package com.csun.cmny.provider.device.watch.entity;

    /// <summary>
    ///  下行 GPS 静默|余额不足语音播报|低电量提醒时间段设置数据包
    ///  关联 017
    ///  The balance of the | downlink GPS silent voice broadcast | low battery alert time set packet
    ///  Association confirmation command FunCode: 017
    /// </summary>
    public class C016
    {
        /// <summary>
        /// 数据起封包 @B#@ 
        /// Start Fixed value :@B#@ 
        /// </summary>
        public String HeadCode = "@B#@";
        /// <summary>
        /// 协议版本号
        /// Protocol version number
        /// </summary>
        public String Protocol = null;
        /// <summary>
        /// 功能代码识别
        /// Function code
        /// </summary>
        public final String FunCode = "016";
        /// <summary>
        /// 国际移动设备身份码
        /// International Mobile Equipment Identity
        /// </summary>
        public String IMEI = null;
        /// <summary>
        /// 1: GPS 静默	2: 语音播报	3:  低电量提醒  设置类型
        /// 1: GPS silent 2: voice broadcast 3: low power reminder settings type
        /// </summary>
        public int SetType =0;
        /// <summary>
        /// 起始时间时分，不足位用 0 填充(range:0000-2359)
        /// At the start time, the insufficient bit is filled with 0 (range:0000-2359)
        /// </summary>
        public String BeginTime = null;
        /// <summary>
        /// 结束时分，不足位用 0 填充(range:0000-2359)
        /// At the end of the time, the insufficient bit is filled with 0 (range:0000-2359)
        /// </summary>
        public String OverTime = null;
        /// <summary>
        /// 终端当前时间(年月日时分秒) yyyyMMddHHmmss
        /// The terminal current time ( format:yyyyMMddHHmmss)
        /// </summary>
        public String TerminalTime  = null;
        /// <summary>
        /// 任务标识，用户自定义，方便回传标识
        /// Task identity, user custom, convenient return identification
        /// </summary>
        public String TaskId = null;
        /// <summary>
        /// 结尾封包 @E#@
        /// End packet @E#@
        /// </summary>
        public String FootCode = "@E#@";


        /// <summary>
        /// 初始化模型
        ///@B#@|01|016|111112222233333|2|2100|0600|20160715162720|0255BB90395C475E9D6155AF98B38387|@E#@
        /// </summary>
        /// <param name="cmdStr">命令代码</param>
        public C016(String cmdStr)
        {

        	String [] data = cmdStr.split("\\|");
            int dataLength = data.length;
            //正确格式下 最小长度为12
            if (dataLength == 10 && "@B#@".equals(data[0]) && FunCode.equals(data[2]))
            {
                HeadCode = data[0];
                Protocol = data[1];
                IMEI = data[3];
                SetType = Integer.parseInt(data[4]);
                BeginTime = data[5];
                OverTime = data[6];
                TerminalTime = data[7];
                TaskId = data[8];
                FootCode = data[9];
            }
        }
        public  String ToString()
        {
        	String rString = HeadCode + "|";
            rString += Protocol + "|";
            rString += FunCode + "|";
            rString += IMEI + "|";
            rString += SetType + "|";
            rString += BeginTime + "|";
            rString += OverTime + "|";
            rString += TerminalTime + "|";
            rString += TaskId + "|";
            rString += FootCode;
            return rString;
        }
    }



